import java.rmi.RemoteException;

import rmiClient.Client_IMPL;
import rmiClient.Token;

/**
 * 
 */

/**
 * @author arthur
 * 
 */
public class TestElectionWithoutDiffusion {

	/**
	 * @param args
	 * @throws RemoteException
	 * @throws InterruptedException
	 */
	public static void main(String[] args) throws RemoteException,
			InterruptedException {
		Client_IMPL c1, c2, c3, c4;
		c1 = new Client_IMPL(null, 1, 10, "localhost",
				"/home/arthur/Documents/Dropbox/Fac/S6/SDI/");
		c2 = new Client_IMPL(null, 2, 5, "localhost",
				"/home/arthur/Documents/Dropbox/Fac/S6/SDI/");
		c3 = new Client_IMPL(null, 3, 15, "localhost",
				"/home/arthur/Documents/Dropbox/Fac/S6/SDI/");
		c4 = new Client_IMPL(null, 4, 20, "localhost",
				"/home/arthur/Documents/Dropbox/Fac/S6/SDI/");

		c1.addNeighbor(c2);
		c2.addNeighbor(c1);
		c2.addNeighbor(c3);
		c3.addNeighbor(c2);
		c3.addNeighbor(c4);
		c4.addNeighbor(c3);

		Token t = new Token(c1, "forman.mov");
		c1.electionWithoutDiffusion(t);

		Thread.sleep(5000);
		for (String[] s : c1.getElectionWithoutDiffusionResult()) {
			System.out.println("Le gagnant est : " + s[0]);
		}

		System.exit(0);

	}

}
